package com.itheima.controller;

import com.itheima.domian.JDdomain;

import com.itheima.service.JDService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/*@Controller
@ResponseBody*/
@RestController
@RequestMapping("product")
public class JDController {

    @Autowired
    private JDService jDService;

    @GetMapping("{name}")
    public List<JDdomain> findAll(@PathVariable String name){
        return jDService.findAll(name);
    }


    @PostMapping
    Integer insert(@RequestBody JDdomain jd){
        return jDService.insert(jd);
    }
}
